#!/sbin/openrc-run
supervisor=supervise-daemon

name="tlstunnel"
description="TLS reverse proxy"

command=/usr/sbin/tlstunnel
command_user=tlstunnel:tlstunnel
capabilities="^cap_net_bind_service"

extra_started_commands="reload"
description_reload="Reload configuration"

: ${error_log:=/var/log/tlstunnel.log}

depend() {
	need net localmount
	after firewall
}

start_pre() {
	[ -n "$error_log" ] && checkpath -f -o tlstunnel:tlstunnel "$error_log"
}

reload() {
	ebegin "Reloading configuration"
	$supervisor $RC_SVCNAME --signal HUP
	eend $?
}
